//
//  AppDelegate.m
//  tabBarDemo
//
//  Created by kingboyrang on 2021/5/3.
//  Copyright © 2021 wulanzhou. All rights reserved.
//

#import "AppDelegate.h"
#import "UIImage+CZExtend.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    //修改tabbar背景色方式1
    //[[UITabBar appearance] setBackgroundColor:[UIColor redColor]];
    //[[UITabBar appearance] setBackgroundImage:[UIImage createImageWithColor:[UIColor redColor]]];
    
    //修改tabbar背景色方式2
    [[UITabBar appearance] setBackgroundImage:[UIImage createImageWithColor:[UIColor redColor]]];
    [UITabBar appearance].translucent = NO;
    

    if (@available(iOS 13.0, *)) {
        //iOS13 之后的方法
        //设置 UITabBarItem 的未选中颜色
        [[UITabBar appearance] setUnselectedItemTintColor:[UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0]];
    }else{
        //iOS13之前修改的方法
        //未选中颜色
       NSDictionary * noselectedTitleColordic =@{NSForegroundColorAttributeName:[UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0]};
       [[UITabBarItem appearance] setTitleTextAttributes:noselectedTitleColordic forState:UIControlStateNormal];
       //选中颜色
       NSDictionary * selectedTitleColordic =@{NSForegroundColorAttributeName:[UIColor colorWithRed:36/255.0 green:198/255.0 blue:120/255.0 alpha:1.0]};
       [[UITabBarItem appearance] setTitleTextAttributes:selectedTitleColordic forState:UIControlStateSelected];
    }
    
    return YES;
}


#pragma mark - UISceneSession lifecycle


- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
    // Called when a new scene session is being created.
    // Use this method to select a configuration to create the new scene with.
    return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}


- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
    // Called when the user discards a scene session.
    // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
    // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


@end
